package basedemo
//多赋值
def (name,age)=["houzheng",25]
println "$name,$age"
//变量交换
def (a,b)=[5,10]
println a+","+b
(a,b)=[b,a] //变量互换
println a+","+b
def (x,y,z)=[1,2] //数组不够,z为null
println "$x,$y,$z"
def (m,n)=[7,8,9] //默认取前面参数
println "$m,$n"
//as 关键字，会把所有接口中的调用都指向 as左侧的代码块，不用显式的new Runnable
//new Thread({println "运行线程"} as Runnable).start()
//实现多个,可用一个数组
//groovy会尝试推断,不必写表达式
String str01=""
String str02="haha"
println str01? true: false
println str02? true: false
list01=[]
list02=[2]
println list01? true: false
println list02? true: false
